//
//  CreateJobSuccessView.swift
//  GreenDeal
//
//  Created by Moennig Q on 2023/3/31.
//

import UIKit
import SnapKit
class CreateJobSuccessView: GreenNaviBarView {
    let gwtNoLabel = ContentLabel(R.font.interMedium(size: 13),hexStr: "#292D3299")
    let okBtn = OperationButton(R.string.localizable.oK())
    override func setUpView() {
        self.backToPreBtn.isHidden = true
        let backView = UIView()
        backView.drawCorner(byRoundingCorners: [.topLeft,.topRight])
        self.addSubview(backView)
        backView.snp.makeConstraints { make in
            make.top.equalTo(topBackView.snp.bottom).offset(-20)
            make.left.right.bottom.equalToSuperview()
        }
        //contentView 是为了将整个内容居中显示
        let contentView = UIView()
        contentView.backgroundColor = .white
        backView.addSubview(contentView)
        contentView.snp.makeConstraints { make in
            make.left.right.centerY.equalToSuperview()
            make.height.greaterThanOrEqualTo(0)
        }
        
        let successImageView = UIImageView(image: R.image.createjob_success_icon())
        successImageView.contentMode = .scaleAspectFit
        contentView.addSubview(successImageView)
        successImageView.snp.makeConstraints { make in
            make.top.equalToSuperview()
            make.left.greaterThanOrEqualTo(26)
            make.right.lessThanOrEqualTo(-26)
            make.height.greaterThanOrEqualTo(0)
            make.centerX.equalToSuperview()
        }
        //
        let tipOneLabel = ContentLabel(R.font.interBold(size: 18))
        tipOneLabel.text = "Created successfully!"
        contentView.addSubview(tipOneLabel)
        tipOneLabel.snp.makeConstraints { make in
            make.top.equalTo(successImageView.snp.bottom).offset(30)
            make.width.height.greaterThanOrEqualTo(0)
            make.centerX.equalToSuperview()
        }
        //
        contentView.addSubview(gwtNoLabel)
        gwtNoLabel.snp.makeConstraints { make in
            make.top.equalTo(tipOneLabel.snp.bottom).offset(12)
            make.width.height.greaterThanOrEqualTo(0)
            make.centerX.equalToSuperview()
        }
        contentView.addSubview(okBtn)
        okBtn.snp.makeConstraints { make in
            if APPConfig.WidthForPortrait == 320 {
                make.top.equalTo(gwtNoLabel.snp.bottom).offset(50)
            }else{
                make.top.equalTo(gwtNoLabel.snp.bottom).offset(130)
            }
            make.width.equalTo(200)
            make.height.equalTo(OperationButton.height)
            make.centerX.equalToSuperview()
            make.bottom.equalToSuperview()
        }
        self.setTitleInfo(R.string.localizable.createJob())
    }
    func setData(_ gwtNo: String){
        self.gwtNoLabel.text = gwtNo
    }
}
